package v1

import (
	"itam/internal/model"

	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

// create
type PmCreateReq struct {
	g.Meta         `path:"/pm" tags:"物理机" method:"post" summary:"新增物理机"`
	Name           string      `v:"required" json:"name"`
	OsType         string      `v:"required" json:"osType"`
	Owner          string      `v:"required" json:"owner"`
	Cpu            int         `v:"required" json:"cpu"`
	Memory         int         `v:"required" json:"memory"`
	Disk           int         `v:"required" json:"disk"`
	Brand          string      `v:"required" json:"brand"`
	Model          string      `v:"required" json:"model"`
	IpAddress      string      `v:"required" json:"ipAddress"`
	MachineUsage   string      `v:"required" json:"machineUsage"`
	PurchaseDate   *gtime.Time `v:"date" json:"purchaseDate"`
	RecomandStatus string      `v:"required" json:"recomandStatus"`
}
type PmCreateRes struct {
	Id int
}

// update
type PmUpdateReq struct {
	g.Meta         `path:"/pm" tags:"物理机" method:"put" summary:"更新物理机"`
	Id             int         `v:"required" json:"id"`
	OsType         string      `v:"required" json:"osType"`
	Owner          string      `v:"required" json:"owner"`
	Cpu            int         `v:"required" json:"cpu"`
	Memory         int         `v:"required" json:"memory"`
	Disk           int         `v:"required" json:"disk"`
	Brand          string      `v:"required" json:"brand"`
	Model          string      `v:"required" json:"model"`
	IpAddress      string      `v:"required" json:"ipAddress"`
	MachineUsage   string      `json:"machineUsage"`
	PurchaseDate   *gtime.Time `v:"date" json:"purchaseDate"`
	RecomandStatus string      `v:"required" json:"recomandStatus"`
}
type PmUpdateRes struct{}

// delete
type PmDeleteReq struct {
	g.Meta `path:"/pm/{Id}" tags:"物理机" method:"delete" summary:"删除物理机"`
	Id     int `in:"path" json:"id" v:"min:1#请选择需要删除的物理机" dc:"物理机id"`
}
type PmDeleteRes struct{}

// getlist
type PmGetListReq struct {
	g.Meta         `path:"/pm" tags:"物理机" method:"get" summary:"物理机列表"`
	OsType         string `json:"osType" description:"操作系统"`
	Owner          string `json:"owner"          description:"负责人"`
	Brand          string `json:"brand"          description:"品牌"`
	Model          string `json:"model"          description:"型号"`
	IpAddress      string `json:"ipAddress"      description:"ip地址"`
	RecomandStatus string `json:"recomandStatus" description:"期望状态"`
	Page           int    `json:"page"`
	Size           int    `json:"size" d:"50"`
}
type PmGetListRes struct {
	List  []model.PmGetListOutputItem `json:"list" description:"列表"`
	Page  int                         `json:"page" description:"分页码"`
	Size  int                         `json:"size" description:"分页数量"`
	Total int                         `json:"total" description:"数据总数"`
}

//type PmGetListOutputItem struct {
//	Pm *PmListItem `json:"pm"`
//}

//type PmListItem struct {
//	Id             int         `json:"id"             description:""`
//	Name           string      `json:"name"           description:"名称"`
//	Owner          string      `json:"owner"          description:"负责人"`
//	Cpu            int         `json:"cpu"            description:"核心数"`
//	Memory         int         `json:"memory"         description:"内存g"`
//	Disk           int         `json:"disk"           description:"磁盘g"`
//	Brand          string      `json:"brand"          description:"品牌"`
//	Model          string      `json:"model"          description:"型号"`
//	IpAddress      string      `json:"ipAddress"      description:"ip地址"`
//	MachineUsage   string      `json:"machineUsage"   description:"用途"`
//	PurchaseDate   *gtime.Time `json:"purchaseDate"   description:"采购日期"`
//	RecomandStatus string      `json:"recomandStatus" description:"期望状态"`
//}

// detail
type PmDetailReq struct {
	g.Meta `path:"/pm/{id}" tags:"物理机" method:"get" summary:"物理机详情"`
	Id     int `in:"path" json:"id" v:"min:1#请选择需要查询的虚拟机" dc:"虚拟机id"`
}
type PmDetailRes struct {
	VmList []model.PmDetailVmItem `json:"vmList" description:"虚拟机列表"`
}

//type PmDetailVmItem struct {
//	Id        int    `json:"id"             description:""`
//	Name      string `json:"name"           description:"名称"`
//	Owner     string `json:"owner"          description:"负责人"`
//	IpAddress string `json:"ipAddress"      description:"ip地址"`
//	EnvId     int    `json:"envId"          description:"环境id"`
//}
